<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>


<input type="text">
<input type="button" value="帅哥" onclick="f(1)" class="man">
<input type="button" value="美女" onclick="f(2)" class="wman">
<div></div>

<script>
    let input = document.querySelector("input");
    function f(x) {
        let src = x == 1?"img.png":"img_1.png";
        let i = document.createElement("img");
        i.src = src;
        for (let j = 0; j < input.value; j++) {
            let i = document.createElement("img");
            i.src = src;
            document.body.append(i);
        }
        document.body.append(i);

    }
</script>
</body>
</html>